package com.zzxx.wechat.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum CountryEnum {
    //地区变更的范围为 us:美国，ca:加拿大，it:意大利

    AMERICA("us", "美国"),

    CANADA("ca", "加拿大"),

    ITALY("it", "意大利"),

    ;

    private String code;

    private String desc;

    public static CountryEnum of(String code) {
        return Arrays.stream(CountryEnum.values())
                .filter(x -> x.getCode().equals(code)).findAny()
                .orElse(null);
    }
}
